home *** CD-ROM | disk | FTP | other *** search
/ Windows Game Programming for Dummies (2nd Edition) / WinGamProgFD.iso / pc / DirectX SDK / DXSDK / samples / Multimedia / VBSamples / DirectPlay / VoiceGroup / frmVoice.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-10-08  |  20.6 KB  |  489 lines

  1. VERSION 5.00
  2. Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
  3. Begin VB.Form frmVoice 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "DirectPlay Voice Sample"
  6.    ClientHeight    =   3285
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   5985
  10.    Icon            =   "frmVoice.frx":0000
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   3285
  15.    ScaleWidth      =   5985
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.CommandButton cmdClient 
  18.       Caption         =   "Settings"
  19.       Default         =   -1  'True
  20.       Height          =   375
  21.       Left            =   4680
  22.       TabIndex        =   7
  23.       Top             =   300
  24.       Width           =   1215
  25.    End
  26.    Begin VB.CommandButton cmdCancel 
  27.       Cancel          =   -1  'True
  28.       Caption         =   "Exit"
  29.       Height          =   375
  30.       Left            =   4680
  31.       TabIndex        =   6
  32.       Top             =   780
  33.       Width           =   1215
  34.    End
  35.    Begin VB.ComboBox cboTalkingGroup 
  36.       Height          =   315
  37.       ItemData        =   "frmVoice.frx":0442
  38.       Left            =   1980
  39.       List            =   "frmVoice.frx":0458
  40.       Style           =   2  'Dropdown List
  41.       TabIndex        =   5
  42.       Top             =   2880
  43.       Width           =   2595
  44.    End
  45.    Begin VB.ComboBox cboMyGroup 
  46.       Height          =   315
  47.       ItemData        =   "frmVoice.frx":0498
  48.       Left            =   1980
  49.       List            =   "frmVoice.frx":04AE
  50.       Style           =   2  'Dropdown List
  51.       TabIndex        =   3
  52.       Top             =   2520
  53.       Width           =   2595
  54.    End
  55.    Begin MSComctlLib.ListView lvMembers 
  56.       Height          =   2175
  57.       Left            =   60
  58.       TabIndex        =   1
  59.       Top             =   300
  60.       Width           =   4515
  61.       _ExtentX        =   7964
  62.       _ExtentY        =   3836
  63.       View            =   3
  64.       LabelEdit       =   1
  65.       LabelWrap       =   -1  'True
  66.       HideSelection   =   -1  'True
  67.       _Version        =   393217
  68.       ForeColor       =   -2147483640
  69.       BackColor       =   -2147483643
  70.       BorderStyle     =   1
  71.       Appearance      =   1
  72.       NumItems        =   4
  73.       BeginProperty ColumnHeader(1) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  74.          Text            =   "Name"
  75.          Object.Width           =   2540
  76.       EndProperty
  77.       BeginProperty ColumnHeader(2) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  78.          SubItemIndex    =   1
  79.          Text            =   "Status"
  80.          Object.Width           =   1235
  81.       EndProperty
  82.       BeginProperty ColumnHeader(3) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  83.          SubItemIndex    =   2
  84.          Text            =   "Group"
  85.          Object.Width           =   2117
  86.       EndProperty
  87.       BeginProperty ColumnHeader(4) {BDD1F052-858B-11D1-B16A-00C0F0283628} 
  88.          SubItemIndex    =   3
  89.          Text            =   "Target"
  90.          Object.Width           =   1764
  91.       EndProperty
  92.    End
  93.    Begin VB.Label lblInfo 
  94.       BackStyle       =   0  'Transparent
  95.       Caption         =   "I'm talking to this group:"
  96.       Height          =   255
  97.       Index           =   2
  98.       Left            =   60
  99.       TabIndex        =   4
  100.       Top             =   2940
  101.       Width           =   1815
  102.    End
  103.    Begin VB.Label lblInfo 
  104.       BackStyle       =   0  'Transparent
  105.       Caption         =   "I'm currently in the group:"
  106.       Height          =   255
  107.       Index           =   1
  108.       Left            =   60
  109.       TabIndex        =   2
  110.       Top             =   2580
  111.       Width           =   1815
  112.    End
  113.    Begin VB.Label lblInfo 
  114.       BackStyle       =   0  'Transparent
  115.       Caption         =   "Members of this conversation:"
  116.       Height          =   255
  117.       Index           =   0
  118.       Left            =   120
  119.       TabIndex        =   0
  120.       Top             =   60
  121.       Width           =   3855
  122.    End
  123. Attribute VB_Name = "frmVoice"
  124. Attribute VB_GlobalNameSpace = False
  125. Attribute VB_Creatable = False
  126. Attribute VB_PredeclaredId = True
  127. Attribute VB_Exposed = False
  128. Option Explicit
  129. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  130. '  Copyright (C) 1999-2001 Microsoft Corporation.  All Rights Reserved.
  131. '  File:       frmVoice.frm
  132. '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
  133. Implements DirectPlayVoiceEvent8
  134. Implements DirectPlay8Event
  135. Private Sub UpdateList(ByVal lPlayerID As Long, fTalking As Boolean)
  136.     Dim lCount As Long
  137.     For lCount = lvMembers.ListItems.Count To 1 Step -1
  138.         If lvMembers.ListItems.Item(lCount).Key = "K" & CStr(lPlayerID) Then
  139.             'Change this guys status
  140.             If fTalking Then
  141.                 lvMembers.ListItems.Item(lCount).SubItems(1) = "Talking"
  142.             Else
  143.                 lvMembers.ListItems.Item(lCount).SubItems(1) = "Silent"
  144.             End If
  145.         End If
  146.     Next
  147. End Sub
  148. Private Sub cboMyGroup_Click()
  149.     On Error Resume Next
  150.     Dim lMsg As Long, lOffset As Long
  151.     Dim oBuf() As Byte
  152.     'Ok, I don't want to be in this group anymore.. let's change..
  153.     UpdateGroup glMyPlayerID, cboMyGroup.ListIndex
  154.     'Now send a message to everyone telling them
  155.     If DPlayEventsForm.IsHost Then
  156.         If cboMyGroup.ListIndex = 0 Then
  157.             RemovePlayerFromAllGroups glMyPlayerID
  158.         Else
  159.             RemovePlayerFromAllGroups glMyPlayerID
  160.             'Add myself to the new group
  161.             dpp.AddPlayerToGroup glGroupID(cboMyGroup.ListIndex), glMyPlayerID, 0
  162.         End If
  163.     Else
  164.         lMsg = MSG_SERVERCHANGEGROUP
  165.         lOffset = NewBuffer(oBuf)
  166.         AddDataToBuffer oBuf, lMsg, LenB(lMsg), lOffset
  167.         AddDataToBuffer oBuf, CLng(cboMyGroup.ListIndex), SIZE_LONG, lOffset
  168.         dpp.SendTo DPNID_ALL_PLAYERS_GROUP, oBuf, 0, DPNSEND_GUARANTEED Or DPNSEND_NOLOOPBACK
  169.     End If
  170.     lMsg = MSG_CHANGEGROUP
  171.     lOffset = NewBuffer(oBuf)
  172.     AddDataToBuffer oBuf, lMsg, LenB(lMsg), lOffset
  173.     AddDataToBuffer oBuf, CLng(cboMyGroup.ListIndex), SIZE_LONG, lOffset
  174.     dpp.SendTo DPNID_ALL_PLAYERS_GROUP, oBuf, 0, DPNSEND_GUARANTEED Or DPNSEND_NOLOOPBACK
  175. End Sub
  176. Private Sub cboTalkingGroup_Click()
  177.     Dim lMsg As Long, lOffset As Long
  178.     Dim oBuf() As Byte
  179.     Dim lTargets(0) As Long
  180.     'Who do I want to talk to?
  181.     If cboTalkingGroup.ListIndex = 0 Then 'Talk to everyone
  182.         
  183.         lTargets(0) = DVID_ALLPLAYERS
  184.         dvClient.SetTransmitTargets lTargets, 0
  185.     Else
  186.         If DPlayEventsForm.IsHost Then
  187.             lTargets(0) = glGroupID(cboTalkingGroup.ListIndex)
  188.         Else
  189.             lTargets(0) = GetGroupID(cboTalkingGroup.ListIndex)
  190.         End If
  191.         dvClient.SetTransmitTargets lTargets, 0
  192.     End If
  193.     UpdateTarget glMyPlayerID, cboTalkingGroup.ListIndex
  194.     'Now send a message to everyone telling them
  195.     lMsg = MSG_CHANGETALK
  196.     lOffset = NewBuffer(oBuf)
  197.     AddDataToBuffer oBuf, lMsg, LenB(lMsg), lOffset
  198.     AddDataToBuffer oBuf, CLng(cboTalkingGroup.ListIndex), SIZE_LONG, lOffset
  199.     dpp.SendTo DPNID_ALL_PLAYERS_GROUP, oBuf, 0, DPNSEND_GUARANTEED Or DPNSEND_NOLOOPBACK
  200. End Sub
  201. Private Sub cmdCancel_Click()
  202.     Unload Me
  203. End Sub
  204. Private Sub cmdClient_Click()
  205.     'Show the settings screen, and re-adjust them
  206.     frmVoiceSettings.Show vbModal
  207.     dvClient.SetClientConfig oClient
  208. End Sub
  209. Private Sub Form_Load()
  210.     Dim dpGroupInfo As DPN_GROUP_INFO
  211.     Dim lCount As Long
  212.     DPlayEventsForm.RegisterCallback Me
  213.     'First let's set up the DirectPlayVoice stuff since that's the point of this demo
  214.     If DPlayEventsForm.IsHost Then
  215.         'After we've created (and opened) the session and got the first player, let's start
  216.         'the DplayVoice server
  217.         
  218.         If (dvServer Is Nothing) Then Set dvServer = dx.DirectPlayVoiceServerCreate
  219.             
  220.         dvServer.Initialize dpp, 0
  221.         dvServer.StartSession oSession, 0
  222.     End If
  223.     'Now create a client as well (so we can both talk and listen)
  224.     Set dvClient = dx.DirectPlayVoiceClientCreate
  225.     'Now let's create a client event..
  226.     dvClient.StartClientNotification Me
  227.     dvClient.Initialize dpp, 0
  228.     oSound.hwndAppWindow = Me.hwnd
  229.     On Error Resume Next
  230.     dvClient.Connect oSound, oClient, 0
  231.     If Err.Number = DVERR_RUN_SETUP Then    'The audio tests have not been run on this
  232.                                             'machine.  Run them now.
  233.         'we need to run setup first
  234.         Dim dvSetup As DirectPlayVoiceTest8
  235.         
  236.         Set dvSetup = dx.DirectPlayVoiceTestCreate
  237.         dvSetup.CheckAudioSetup vbNullString, vbNullString, Me.hwnd, 0 'Check the default devices since that's what we'll be using
  238.         If Err.Number = DVERR_COMMANDALREADYPENDING Then
  239.             MsgBox "Could not start DirectPlayVoice.  The Voice Networking wizard is already open.  This sample must exit.", vbOKOnly Or vbInformation, "No Voice"
  240.             Cleanup
  241.             Unload Me
  242.             End
  243.         End If
  244.         If Err.Number = DVERR_USERCANCEL Then
  245.             MsgBox "Could not start DirectPlayVoice.  The Voice Networking wizard has been cancelled.  This sample must exit.", vbOKOnly Or vbInformation, "No Voice"
  246.             Cleanup
  247.             Unload Me
  248.             End
  249.         End If
  250.         Set dvSetup = Nothing
  251.         dvClient.Connect oSound, oClient, 0
  252.     ElseIf Err.Number <> 0 And Err.Number <> DVERR_PENDING Then
  253.         MsgBox "Could not start DirectPlayVoice.  This sample must exit." & vbCrLf & "Error:" & CStr(Err.Number), vbOKOnly Or vbCritical, "Exiting"
  254.         Cleanup
  255.         Unload Me
  256.         End
  257.     End If
  258.     'We need to create our 5 groups
  259.     For lCount = 1 To 5
  260.         With dpGroupInfo
  261.             .lInfoFlags = DPNINFO_NAME
  262.             .Name = "Group" & CStr(lCount)
  263.         End With
  264.         dpp.CreateGroup dpGroupInfo, 0
  265.     Next
  266.     cboMyGroup.ListIndex = 0
  267.     cboTalkingGroup.ListIndex = 0
  268.     UpdatePlayerList
  269. End Sub
  270. Public Sub AddPlayer(ByVal lPlayerID As Long, ByVal sName As String)
  271.     Dim lItem As ListItem
  272.     Set lItem = lvMembers.ListItems.Add(, "K" & CStr(lPlayerID), sName)
  273.     lItem.SubItems(1) = "Silent"
  274.     lItem.SubItems(2) = cboMyGroup.List(0)
  275.     lItem.SubItems(3) = cboTalkingGroup.List(0)
  276. End Sub
  277. Public Sub RemovePlayer(ByVal lPlayerID As Long)
  278.     Dim lCount As Long
  279.     For lCount = lvMembers.ListItems.Count To 1 Step -1
  280.         If lvMembers.ListItems.Item(lCount).Key = "K" & CStr(lPlayerID) Then
  281.             'Remove this one
  282.             lvMembers.ListItems.Remove lCount
  283.         End If
  284.     Next
  285. End Sub
  286. Private Sub Form_Unload(Cancel As Integer)
  287.     Me.Hide
  288.     DPlayEventsForm.DoSleep 50
  289.     Cleanup
  290. End Sub
  291. Public Sub UpdateTarget(ByVal lPlayerID As Long, ByVal lIndex As Long)
  292.     Dim lCount As Long
  293.     For lCount = lvMembers.ListItems.Count To 1 Step -1
  294.         If lvMembers.ListItems.Item(lCount).Key = "K" & CStr(lPlayerID) Then
  295.             'Change my group
  296.             lvMembers.ListItems.Item(lCount).SubItems(3) = cboTalkingGroup.List(lIndex)
  297.         End If
  298.     Next
  299. End Sub
  300. Public Sub UpdateGroup(ByVal lPlayerID As Long, ByVal lIndex As Long)
  301.     Dim lCount As Long
  302.     For lCount = lvMembers.ListItems.Count To 1 Step -1
  303.         If lvMembers.ListItems.Item(lCount).Key = "K" & CStr(lPlayerID) Then
  304.             'Change my group
  305.             lvMembers.ListItems.Item(lCount).SubItems(2) = cboMyGroup.List(lIndex)
  306.         End If
  307.     Next
  308. End Sub
  309. Private Function AmIInList(ByVal lPlayerID As Long) As Boolean
  310.     Dim lCount As Long, fInThis As Boolean
  311.     For lCount = lvMembers.ListItems.Count To 1 Step -1
  312.         If lvMembers.ListItems.Item(lCount).Key = "K" & CStr(lPlayerID) Then
  313.             fInThis = True
  314.         End If
  315.     Next
  316.     AmIInList = fInThis
  317. End Function
  318. Private Sub UpdatePlayerList()
  319.     'Get everyone who is currently in the session and add them if we don't have them currently.
  320.     Dim lCount As Long
  321.     Dim Player As DPN_PLAYER_INFO
  322.     ' Enumerate players
  323.     For lCount = 1 To dpp.GetCountPlayersAndGroups(DPNENUM_PLAYERS)
  324.         If Not (AmIInList(dpp.GetPlayerOrGroup(lCount))) Then 'Add this player
  325.             Dim lItem As ListItem, sName As String
  326.             Player = dpp.GetPeerInfo(dpp.GetPlayerOrGroup(lCount))
  327.             sName = Player.Name
  328.             If sName = vbNullString Then sName = "Unknown"
  329.             If (Player.lPlayerFlags And DPNPLAYER_LOCAL = DPNPLAYER_LOCAL) Then glMyPlayerID = dpp.GetPlayerOrGroup(lCount)
  330.             Set lItem = lvMembers.ListItems.Add(, "K" & CStr(dpp.GetPlayerOrGroup(lCount)), sName)
  331.             lItem.SubItems(1) = "Silent"
  332.             lItem.SubItems(2) = cboMyGroup.List(0)
  333.             lItem.SubItems(3) = cboTalkingGroup.List(0)
  334.         End If
  335.     Next lCount
  336. End Sub
  337. Private Function GetGroupID(ByVal lIndex As Long) As Long
  338.     Dim lCount As Long
  339.     Dim dpGroup As DPN_GROUP_INFO
  340.     For lCount = 1 To dpp.GetCountPlayersAndGroups(DPNENUM_GROUPS)
  341.         dpGroup = dpp.GetGroupInfo(dpp.GetPlayerOrGroup(lCount))
  342.         If dpGroup.Name = "Group" & CStr(lIndex) Then
  343.             GetGroupID = dpp.GetPlayerOrGroup(lCount)
  344.         End If
  345.     Next lCount
  346. End Function
  347. Private Sub DirectPlay8Event_AddRemovePlayerGroup(ByVal lMsgID As Long, ByVal lPlayerID As Long, ByVal lGroupID As Long, fRejectMsg As Boolean)
  348.     'VB requires that we must implement *every* member of this interface
  349. End Sub
  350. Private Sub DirectPlay8Event_AppDesc(fRejectMsg As Boolean)
  351.     'VB requires that we must implement *every* member of this interface
  352. End Sub
  353. Private Sub DirectPlay8Event_AsyncOpComplete(dpnotify As DxVBLibA.DPNMSG_ASYNC_OP_COMPLETE, fRejectMsg As Boolean)
  354.     'VB requires that we must implement *every* member of this interface
  355. End Sub
  356. Private Sub DirectPlay8Event_ConnectComplete(dpnotify As DxVBLibA.DPNMSG_CONNECT_COMPLETE, fRejectMsg As Boolean)
  357.     If dpnotify.hResultCode <> 0 Then
  358.         'For some reason we could not connect.  All available slots must be closed.
  359.         MsgBox "Connect Failed.  Error: 0x" & CStr(Hex$(dpnotify.hResultCode)) & "  - This sample will now close.", vbOKOnly Or vbCritical, "Closing"
  360.         DPlayEventsForm.CloseForm Me
  361.     End If
  362. End Sub
  363. Private Sub DirectPlay8Event_CreateGroup(ByVal lGroupID As Long, ByVal lOwnerID As Long, fRejectMsg As Boolean)
  364.     Dim lGroupNum As Long
  365.     Dim dpGroup As DPN_GROUP_INFO
  366.     dpGroup = dpp.GetGroupInfo(lGroupID)
  367.     lGroupNum = CLng(Right$(dpGroup.Name, 1))
  368.     glGroupID(lGroupNum) = lGroupID
  369. End Sub
  370. Private Sub DirectPlay8Event_CreatePlayer(ByVal lPlayerID As Long, fRejectMsg As Boolean)
  371.     Dim dpPeer As DPN_PLAYER_INFO
  372.     dpPeer = dpp.GetPeerInfo(lPlayerID)
  373.     AddPlayer lPlayerID, dpPeer.Name
  374.     If (dpPeer.lPlayerFlags And DPNPLAYER_LOCAL) = DPNPLAYER_LOCAL Then
  375.         glMyPlayerID = lPlayerID
  376.     End If
  377. End Sub
  378. Private Sub DirectPlay8Event_DestroyGroup(ByVal lGroupID As Long, ByVal lReason As Long, fRejectMsg As Boolean)
  379.     'VB requires that we must implement *every* member of this interface
  380. End Sub
  381. Private Sub DirectPlay8Event_DestroyPlayer(ByVal lPlayerID As Long, ByVal lReason As Long, fRejectMsg As Boolean)
  382.     RemovePlayer lPlayerID
  383.     If lPlayerID = glMyPlayerID Then
  384.         glMyPlayerID = 0
  385.     End If
  386. End Sub
  387. Private Sub DirectPlay8Event_EnumHostsQuery(dpnotify As DxVBLibA.DPNMSG_ENUM_HOSTS_QUERY, fRejectMsg As Boolean)
  388.     'VB requires that we must implement *every* member of this interface
  389. End Sub
  390. Private Sub DirectPlay8Event_EnumHostsResponse(dpnotify As DxVBLibA.DPNMSG_ENUM_HOSTS_RESPONSE, fRejectMsg As Boolean)
  391.     'VB requires that we must implement *every* member of this interface
  392. End Sub
  393. Private Sub DirectPlay8Event_HostMigrate(ByVal lNewHostID As Long, fRejectMsg As Boolean)
  394.     If lNewHostID = glMyPlayerID Then
  395.         frmVoice.Caption = frmVoice.Caption & " (HOST)"
  396.     End If
  397. End Sub
  398. Private Sub DirectPlay8Event_IndicateConnect(dpnotify As DxVBLibA.DPNMSG_INDICATE_CONNECT, fRejectMsg As Boolean)
  399.     'VB requires that we must implement *every* member of this interface
  400. End Sub
  401. Private Sub DirectPlay8Event_IndicatedConnectAborted(fRejectMsg As Boolean)
  402.     'VB requires that we must implement *every* member of this interface
  403. End Sub
  404. Private Sub DirectPlay8Event_InfoNotify(ByVal lMsgID As Long, ByVal lNotifyID As Long, fRejectMsg As Boolean)
  405.     'VB requires that we must implement *every* member of this interface
  406. End Sub
  407. Private Sub DirectPlay8Event_Receive(dpnotify As DxVBLibA.DPNMSG_RECEIVE, fRejectMsg As Boolean)
  408.     Dim lCount As Long, lOffset As Long
  409.     Dim lMsg As Long
  410.     Dim lIndex As Long
  411.     'Here we will go through the messages
  412.     'The first item in our byte array is the MSGID we passed in
  413.     With dpnotify
  414.     GetDataFromBuffer .ReceivedData, lMsg, LenB(lMsg), lOffset
  415.     Select Case lMsg
  416.     Case MSG_CHANGEGROUP
  417.         GetDataFromBuffer .ReceivedData, lIndex, LenB(lIndex), lOffset
  418.         frmVoice.UpdateGroup dpnotify.idSender, lIndex
  419.     Case MSG_CHANGETALK
  420.         GetDataFromBuffer .ReceivedData, lIndex, LenB(lIndex), lOffset
  421.         frmVoice.UpdateTarget dpnotify.idSender, lIndex
  422.     Case MSG_SERVERCHANGEGROUP
  423.         If DPlayEventsForm.IsHost Then
  424.             RemovePlayerFromAllGroups dpnotify.idSender
  425.             GetDataFromBuffer .ReceivedData, lIndex, LenB(lIndex), lOffset
  426.             If lIndex > 0 Then dpp.AddPlayerToGroup glGroupID(lIndex), dpnotify.idSender, 0
  427.             frmVoice.UpdateGroup dpnotify.idSender, lIndex
  428.         End If
  429.     End Select
  430.     End With
  431. End Sub
  432. Private Sub DirectPlay8Event_SendComplete(dpnotify As DxVBLibA.DPNMSG_SEND_COMPLETE, fRejectMsg As Boolean)
  433.     'VB requires that we must implement *every* member of this interface
  434. End Sub
  435. Private Sub DirectPlay8Event_TerminateSession(dpnotify As DxVBLibA.DPNMSG_TERMINATE_SESSION, fRejectMsg As Boolean)
  436.     'VB requires that we must implement *every* member of this interface
  437. End Sub
  438. Private Sub DirectPlayVoiceEvent8_ConnectResult(ByVal ResultCode As Long)
  439.     If ResultCode <> 0 Then
  440.         'For some reason we could not connect.  All available slots must be closed.
  441.         MsgBox "Connect Failed.  Error: 0x" & CStr(Hex$(ResultCode)) & "  - This sample will now close.", vbOKOnly Or vbCritical, "Closing"
  442.         DPlayEventsForm.CloseForm Me
  443.     End If
  444. End Sub
  445. Private Sub DirectPlayVoiceEvent8_CreateVoicePlayer(ByVal playerID As Long, ByVal flags As Long)
  446.     'Someone joined, update the player list
  447.     UpdatePlayerList
  448. End Sub
  449. Private Sub DirectPlayVoiceEvent8_DeleteVoicePlayer(ByVal playerID As Long)
  450.     'Someone quit, remove them from the session
  451.     RemovePlayer playerID
  452. End Sub
  453. Private Sub DirectPlayVoiceEvent8_DisconnectResult(ByVal ResultCode As Long)
  454.     'VB requires that we must implement *every* member of this interface
  455. End Sub
  456. Private Sub DirectPlayVoiceEvent8_HostMigrated(ByVal NewHostID As Long, ByVal NewServer As DxVBLibA.DirectPlayVoiceServer8)
  457.     'VB requires that we must implement *every* member of this interface
  458. End Sub
  459. Private Sub DirectPlayVoiceEvent8_InputLevel(ByVal PeakLevel As Long, ByVal RecordVolume As Long)
  460.     'VB requires that we must implement *every* member of this interface
  461. End Sub
  462. Private Sub DirectPlayVoiceEvent8_OutputLevel(ByVal PeakLevel As Long, ByVal OutputVolume As Long)
  463.     'VB requires that we must implement *every* member of this interface
  464. End Sub
  465. Private Sub DirectPlayVoiceEvent8_PlayerOutputLevel(ByVal playerID As Long, ByVal PeakLevel As Long)
  466.     'VB requires that we must implement *every* member of this interface
  467. End Sub
  468. Private Sub DirectPlayVoiceEvent8_PlayerVoiceStart(ByVal playerID As Long)
  469.     'Someone is talking, update the list
  470.     UpdateList playerID, True
  471. End Sub
  472. Private Sub DirectPlayVoiceEvent8_PlayerVoiceStop(ByVal playerID As Long)
  473.     'Someone stopped talking, update the list
  474.     UpdateList playerID, False
  475. End Sub
  476. Private Sub DirectPlayVoiceEvent8_RecordStart(ByVal PeakVolume As Long)
  477.     'I am talking, update the list
  478.     UpdateList glMyPlayerID, True
  479. End Sub
  480. Private Sub DirectPlayVoiceEvent8_RecordStop(ByVal PeakVolume As Long)
  481.     'I have quit talking, update the list
  482.     UpdateList glMyPlayerID, False
  483. End Sub
  484. Private Sub DirectPlayVoiceEvent8_SessionLost(ByVal ResultCode As Long)
  485.     'The voice session has exited, let's quit
  486.     MsgBox "The DirectPlayVoice session was lost.  This sample is exiting.", vbOKOnly Or vbInformation, "Session lost."
  487.     DPlayEventsForm.CloseForm Me
  488. End Sub
  489.